﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class PassAndOut : MonoBehaviour,IPointerExitHandler,IPointerEnterHandler
{
    
    public delegate void PassAndOutDelegate (PointerEventData eventData);

    public PassAndOutDelegate EnterDelegate;
    public PassAndOutDelegate ExitDelegate;
    
    //当鼠标进入UI
    public void OnPointerEnter(PointerEventData eventData)
    {
        if (EnterDelegate != null)
        {
            EnterDelegate(eventData);
        }
    }
 
    //当鼠标离开UI
    public void OnPointerExit(PointerEventData eventData)
    {
        if (ExitDelegate != null)
        {
            ExitDelegate(eventData);
        }
    }
}
